/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package diffteleop_base;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import lcm.lcm.LCM;

/**
 *
 * @author team10
 */
public class Main {

    private static LCM lcm;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        //Get an instance of LCM
        try {
            Main.lcm = new LCM("udpm://239.255.76.10:7667?ttl=1");
        }
        catch (IOException ex) {
            Logger.getLogger(DiffDrive.class.getName()).log(Level.SEVERE, null, ex);
        }

        DiffDrive driver = new DiffDrive(lcm);
        WaypointSend sender = new WaypointSend(lcm);
        new RobotGUI(lcm, driver);

        
        double left = 0.40;
        double right = 0.5;
        double s = 1;
        double dT = 0;
        double last = 10;
        double cntr;
        for (cntr = 0; cntr < last; cntr++) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
            driver.sendLR(left*(cntr/last), right*(cntr/last));
        }
        while(cntr < 100 + last) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
                Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
            //driver.sendLR(left, right);
            driver.sendSDT(s, dT);
            sender.sendWaypoints();
        }
        
    }

}
